package com.example.demo.Tools;

import com.example.demo.Entity.OPeration_Statistics;
import com.example.demo.Entity.Statistics;

public class Modification {
    public static String ModUpdate(OPeration_Statistics os, Statistics sta) {
            //记录每个类型的操作明细
            String s[] = new String[15];
            //记录一个修改的多少处
            int i = 0;

            //判断时间是否进行了修改
            if (!sta.getDate().equals(os.getDate())) {
                s[0] = "时间从" + os.getDate() + "修改到" + sta.getDate();
                i++;
            }
            else
                s[0] = "";
            //判断单位是否进行了修改
            if (!sta.getCompany().equals(os.getCompany())) {
                s[1] = "单位从" + os.getCompany() + "修改为" + sta.getCompany();
                i++;
            }
            else
                s[1] = "";
            //判断部门是否进行了修改
            if (!sta.getDepartment().equals(os.getDepartment())) {
                s[2] = "部门从" + os.getDepartment() + "修改为" + sta.getDepartment();
                i++;
            }
            else
                s[2] = "";
            //判断区域是否进行了修改
            if (!sta.getArea().equals(os.getArea())) {
                s[3] = "区域从" + os.getCompany() + "修改为" + sta.getCompany();
                i++;
            }
            else
                s[3] = "";
            //判断大类是否进行了修改
            if (!sta.getTypeOne().equals(os.getTypeOne())){
                s[4] = "大类从"+os.getTypeOne()+"修改为"+sta.getTypeOne();
                i++;
            }
            else
                s[4] = "";
            //判断二类是否进行了修改
            if (!sta.getTypeTwo().equals(os.getTypeTwo())) {
                s[5] = "二类从" + os.getTypeTwo() + "修改为" + sta.getTypeTwo();
                i++;
            }
            else
                s[5] = "";
            //判断财务归口是否进行了修改
            if (!sta.getFinancialFocus().equals(os.getFinancialFocus())) {
                s[6] = "财务归口从" + os.getFinancialFocus() + "修改为" + sta.getFinancialFocus();
                i++;
            }
            else
                s[6] = "";
            //判断四类是否进行了修改
            if (!sta.getTypeFour().equals(os.getTypeFour())) {
                s[7] = "四类从" + os.getTypeFour() + "修改为" + sta.getTypeFour();
                i++;
            }
            else
                s[7] = "";
            //判断五类是否进行了修改
            if (!sta.getTypeFive().equals(os.getTypeFive())) {
                s[8] = "五类从" + os.getTypeFive() + "修改为" + sta.getTypeFive();
                i++;
            }
            else
                s[8] = "";
            //判断六类是否进行了修改
            if (!sta.getTypeSix().equals(os.getTypeSix())) {
                s[9] = "六类从" + os.getTypeSix() + "修改为" + sta.getTypeSix();
                i++;
            }
            else
                s[9] = "";
            //判断数量是否进行了修改
            if (!sta.getNumber().equals(os.getNumber())) {
                s[10] = "数量从" + os.getNumber() + "修改为" + sta.getNumber();
                i++;
            }
            else
                s[10] = "";
            //判断单价是否进行了修改
            if (!sta.getPrice().equals(os.getPrice())) {
                s[11] = "单价从" + os.getPrice() + "修改为" + sta.getPrice();
                i++;
            }
            else
                s[11] = "";
            //判断总价是否进行了修改
            if (!sta.getTotalPrice().equals(os.getTotalPrice())) {
                s[12] = "总价从" + os.getTotalPrice() + "修改为" + sta.getTotalPrice();
                i++;
            }
            else
                s[12] = "";
            //判断单位是否进行了修改
            if (!sta.getSpecs().equals(os.getSpecs())) {
                s[13] = "单位从" + os.getSpecs() + "修改为" + sta.getSpecs();
                i++;
            }
            else
                s[13] = "";
            //判断备注是否进行了修改
            if (!sta.getRemarks().equals(os.getRemarks())) {
                s[14] = "备注从" + os.getRemarks() + "修改为" + sta.getRemarks();
                i++;
            }
            else
                s[14] = "";
            //将所有判断信息进行拼接 然后返回
            return "进行了"+i+"处地方的修改:"+s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]+" "+s[5]+" "+s[6]+" "+s[7]+" "+s[8]+" "+s[9]+" "+s[10]+" "+s[12]+" "+s[13]+" "+s[14];
     }
}